import { getDataFromId, updateData, addData } from '@vimi/utils-api'
import { getApprove } from '@/credit/mixin/wf'

const flowTableName = 'pay_fee_record'
const relatedTableName = 'customer_related'
const SERVICE_NAME = 'credit'

export const getFlowData = id =>
  getDataFromId(SERVICE_NAME, flowTableName, id).then(res => res?.data ?? {})

const approveConfig = {}

export const updateFlow = (id, data) => updateData(SERVICE_NAME, flowTableName, id, data)

export const addFlow = data => addData(SERVICE_NAME, flowTableName, data)

export const updateRelatedContractStatus = (id, status) =>
  updateData(SERVICE_NAME, relatedTableName, id, {
    contract_approval_status: status,
  })

// 获取审批流程配置信息
export const getApproveProcess = (queryId, user) =>
  getApprove(
    {
      wfKey: 'BACK_POOL_APPROVAL',
      queryId,
      config: approveConfig,
    },
    user
  )

// export const enumUnAttachmentLabel = {
//   1: '解保通知书',
//   2: '转贷通知书',
//   3: '续贷通知书',
//   4: '代偿通知书 ',
//   5: '解保通知书',
// }
